$(function () {
  $('#login-button').on('click', function () {
    var username = $.trim($("[name='username']").val());
    var password = $.trim($("[name='password']").val());

    if (!username) {
      alert("输入用户名字");
      return;
    }
    if (!password) {
      alert('密码');
      return;
    }
    $.ajax({
      url: '/employee/employeeLogin',
      type: 'post',
      data: {
        username: username,
        password: password
      },
      success: function (res) {
        console.log(res);

        if (res.success) {
          //登录成功
          location.href = "user.html";
        } else {
          alert(res.message);
        }
      }

    })
  })
})